package com.github.cyf.controller;

import com.github.cyf.service.LogService;
import com.github.cyf.util.MDCUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

/**
 * @author chenyifan
 * @create 2025-01-09 9:54
 */
@RestController
@RequestMapping("/")
public class LogController {

    @Autowired
    private LogService logService;

    @GetMapping("/")
    public String log() {
        MDCUtil.put("userId", UUID.randomUUID().toString().substring(0, 8));
        logService.log();
        MDCUtil.clear();
        return "成功";
    }
}